package com.yc.controller;


import com.yc.entity.Category;
import com.yc.mapper.CategoryMapper;
import com.yc.vo.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ly
 * @since 2022-05-08
 */
@Controller
@RequestMapping("//category")
public class CategoryController {

    @Resource
    private CategoryMapper categoryMapper;

    @GetMapping("queryAll")
    @ResponseBody
    public Result queryAll(){
        List< Category > categories = categoryMapper.selectList(null);
        return new Result(1, "OK", categories);
    }

    @RequestMapping("queryCategory.do")
    @ResponseBody
    public List< Category > queryCategory(){
        List<Category> list=categoryMapper.selectList(null);
        return list;
    }

}

